package com.smart.fourteen.mybatis.sessiontemplate;

import com.smart.fourteen.mybatis.model.Topic;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author junrui.wang
 * @create 2019/11/13
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("com/smart/fourteen/mybatis/sessiontemplate/applicationContext-mybatis.xml");
        SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) ac.getBean("sqlSessionTemplate");
        Topic topic = sqlSessionTemplate.selectOne("com.smart.fourteen.mybatis.dao.TopicDao.getTopic", 1);
        System.out.println(topic);


    }
}
